package com.cn.组件的快速导入;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @Auther: 代理仁
 * @Date: 2019/7/8 23:06
 * @Description:
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        //判断容器中是否存在该组件
        boolean exit=registry.containsBeanDefinition("com.cn.组件的快速导入.QuickConfigChildThree");
        if(exit){
        //存在就在注册一个
            RootBeanDefinition newBean=new RootBeanDefinition(QuickConfigChildThour.class);
            registry.registerBeanDefinition("four",newBean);
        }
    }
}
